package de.hsmannheim.poolraumapp.model;

public class Room {
	private String building;
	private String number;
	private boolean hasMac;
	private boolean hasWindows;
	private boolean hasLinux;
	
	public Room() { }
	
	public Room(String building, String number, boolean hasMac, boolean hasWindows, boolean hasLinux) {
		this.building = building;
		this.number = number;
		this.hasMac = hasMac;
		this.hasWindows = hasWindows;
		this.hasLinux = hasLinux;
	}
	
	public String getIdentifier() {
		return getBuilding() + getNumber();
	}
	public String getBuilding() {
		return building;
	}
	public String getNumber() {
		return number;
	}
	public boolean hasMac() {
		return hasMac;
	}
	public boolean hasWindows() {
		return hasWindows;
	}
	public boolean hasLinux() {
		return hasLinux;
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((building == null) ? 0 : building.hashCode());
		result = prime * result + (hasLinux ? 1231 : 1237);
		result = prime * result + (hasMac ? 1231 : 1237);
		result = prime * result + (hasWindows ? 1231 : 1237);
		result = prime * result + ((number == null) ? 0 : number.hashCode());
		return result;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Room other = (Room) obj;
		if (building == null) {
			if (other.building != null)
				return false;
		} else if (!building.equals(other.building))
			return false;
		if (hasLinux != other.hasLinux)
			return false;
		if (hasMac != other.hasMac)
			return false;
		if (hasWindows != other.hasWindows)
			return false;
		if (number == null) {
			if (other.number != null)
				return false;
		} else if (!number.equals(other.number))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "Room [building=" + building + ", number=" + number
				+ ", hasMac=" + hasMac + ", hasWindows=" + hasWindows + ", hasLinux="
				+ hasLinux + "]";
	}
	
	
}
